﻿using System;
using HarrisDesigns.Controls.dasBlogControls;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace dasBlogControls.Test
{
    [TestClass]
    public class WhenUpdatingDataStore
    {
        private DataStore<int> _context;

        public DataStore<int> Context
        {
            get
            {
                if (_context == null)
                {
                    _context = new DataStore<int>();
                    _context.UpdateData(int.MaxValue);
                }
                return _context;
            }
        }

        [TestMethod]
        public void ItShouldHaveACurrentUpdateTimestamp()
        {
            Assert.IsTrue(Context.LastUpdate <= DateTime.Now && Context.LastUpdate >= DateTime.Now.AddSeconds(-1));
        }

        [TestMethod]
        public void ItShouldContainIntMaxValue()
        {
            Assert.AreEqual(int.MaxValue, Context.Data);
        }
    }
}